layui.use(['layer','form','table','element','layedit','upload','laydate'],function () {
    var layer = layui.layer
        ,form = layui.form
        ,table =layui.table
        ,element = layui.element
        ,layedit = layui.layedit
        ,laydate = layui.laydate
        ,upload = layui.upload;

    laydate.render({
        elem: '#driverTime' //指定元素
    });

//提交表单
form.on('submit(form)',function (data) {

    var data = {
        "id":$("#id").val(),
        "userName":$("#userName").val(),
        "trueName":$("#trueName").val(),
        "idCard":$("#idCard").val(),
        "password":$("#password").val(),
        "phone":$("#phone").val(),
        "type":$("#type").val(),
        "showDriverTime":$("#driverTime").val(),
        "drvierAge":$("#drvierAge").val(),
        "driverNo":$("#driverNo").val()
    };

    //保存项目
    $.ajax({
        url:"/admin/driver/update",
        type:"POST",
        data:data,
        success:function (result) {
            // console.log("data=="+form_data)
            if(result.flag){
                layer.confirm(result.message, {
                    btn: ['确定'] //按钮
                }, function(){
                    parent.layui.element.tabDelete('tabs','driver_edit');
                });
            }else{
                layer.msg(result.message);
            }
        },
        error:function () {
            layer.msg("系统错误！");
        }
    });

});

});